/*
>> LUTNeighbourhoodToPixelOp.s
>>
>> LUT-based Neighbourhood operation skeleton, 
>>
>> Author: Wouter Caarls
>> Date:   06-04-2005
*/

#include "ilpstrategies.h"

strategy declarescalararguments(code _args, code _arguments, code _body)
{
  int _ii;

  for (_ii=0; _ii < _arguments; _ii++)
  {
    if (_args[_ii].argtype == ARG_SCALAR_IN)
    {
      /* Non-streams must be initialised */
      @declare(addrpointer(_args[_ii].datatype), _args[_ii].id);
      if (@dataclass(_args[_ii].datatype) == DATACLASS_INTEGER)
        @_args[_ii].id = &_args[_ii].data.d;
      else if (@dataclass(_args[_ii].datatype) == DATACLASS_FLOAT)
        @_args[_ii].id = &_args[_ii].data.f;
      else
        @_args[_ii].id = cast(addpointer(_args[_ii].datatype), _args[_ii].data.b);
    }
  }
}

void setLUT(int _x, int _y, float _val)
{
  WriteFPGALUT(_x+_lutsize/2, _y+_lutsize/2, _val);
}

strategy LUTNeighbourhoodToPixelOp(code args, code arguments, code body)
{
  int _lutsize=args[0].data.d;

  @declarescalararguments(args, arguments, body);

  @body;
}
